﻿#ifndef MAINFUNCTION_H
#define MAINFUNCTION_H

#include <QMainWindow>
#include <QImage>
#include <QMenu>
#include <QMouseEvent>
#include <QStandardItemModel>
#include <QFileDialog>
#include <QDirIterator>
#include <QMessageBox>
#include <memory>
#include <QTime>
#include <QElapsedTimer>
#include <QRandomGenerator>

#include "alltools.h"

namespace Ui {
class MainFunction;
}

class MainFunction : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainFunction(QWidget *parent = nullptr);
    ~MainFunction();
    QMap<QString,QString> UserInfo;

    QMap<QVector<QString>, std::shared_ptr<float>> UserPic;
    void putUserInfo();

private slots:
    void on_pushButtonCamera_clicked();

    void on_pushButtonCameraLevel_clicked();

    void on_pushButtonCameraPicCmp_clicked();

    void on_pushButtonCameraLog_clicked();

    void on_pushButtonMin_clicked();

    void on_pushButtonQuit_clicked();

    void ClickMenu1();

    void ClickMenu2();

    void ClickMenu3();

    void on_pushButtonStart_4_clicked();

    void on_pushButtonStop_4_clicked();

    void on_pushButtonOpen_clicked();

    void on_pushButtonClose_clicked();

    void on_pushButtonPoint_clicked();

    void on_pushButtonSegment_clicked();

    void on_pushButtonStart_2_clicked();

    void on_pushButtonStop_2_clicked();

    void on_pushButtonStart_3_clicked();

    void on_pushButtonStop_3_clicked();

    void on_pushButtonDetect_clicked();

    void on_pushButtonGetAction_clicked();

    void on_pushButtonStart_clicked();

    void on_pushButtonStop_clicked();

    void on_pushButtonAddPic_clicked();

    void on_pushButtonFind_clicked();

    void on_pushButtonClear_clicked();

    void on_pushButtonSearch_clicked();

    void on_pushButtonGet_clicked();

    void on_pushButtonGetAction_3_clicked();

signals:
    void toLogin();
    void closeAll();

private:
    Ui::MainFunction *ui;
    bool capStatus;
    int capModelId;
    QStandardItemModel* ModelRes;
    QStandardItemModel* ModelDB;

    cv::Mat addPic;

    void ConnectSlots();

protected:
    void mousePressEvent(QMouseEvent *e);
    void mouseMoveEvent(QMouseEvent *e);
    void mouseReleaseEvent(QMouseEvent *e);

private:
    QPoint last;

};

#endif // MAINFUNCTION_H
